bool IsPopOrder(vector<int>& pushV, vector<int>& popV)
{
    stack<int> st;
    int i = 0, j = 0;
    int pushsz = pushV.size();
    int popsz = popV.size();
    while (i <= pushsz)
    {
        while (st.empty() || popV[j] != st.top())
        {
            st.push(pushV[i++]);
            if (i > pushsz)
                return false;
        }
        while (!st.empty() && popV[j] == st.top())
        {
            st.pop();
            j++;
            if (popsz == j)
                return true;
        }
    }
    return false;
}